package com.openness.spider.commons;

/**
 * @author Rain
 * @version 2013-6-21 上午11:32:46
 */

public class ErrorInfo {

	public static String toString(Throwable t) {
		if (t == null) {
			return null;
		}

		StringBuilder sb = new StringBuilder();

		StackTraceElement[] elements = t.getStackTrace();

		for (StackTraceElement element : elements) {
			sb.append(element.getClassName() + " ");
			sb.append(element.getFileName() + " ");
			sb.append(element.getLineNumber() + " ");
			sb.append(element.getMethodName() + "\n");
		}

		return sb.toString();
	}
}
